package com.zh.note.demo.javaSE;

import java.util.Arrays;
import java.util.Locale;

/**
 * @Author: zhanghuan
 * @date: 2023/4/2 18:34
 * @description: create it
 */
public class StringDemo {


    public static void main(String[] args) {
        // String s1 = "Programming";
        // String s2 = new String("Programming");
        // String s3 = "Program";
        // String s4 = "ming";
        // String s5 = "Program" + "ming";
        // String s6 = s3 + s4;
        // System.out.println(s1 == s2);//false
        // System.out.println(s1 == s5);//true
        // System.out.println(s1 == s6);//false
        // System.out.println(s1 == s6.intern());//true
        // System.out.println(s2 == s2.intern());//false

        // 截取字符串
        String str = "=C51a";
        System.out.println(str.substring(2)); // 51a
        // 字符串替换
        System.out.println(str.replace("a", "b")); //=C51b
        //小写字符串变成大写
        System.out.println(str.toUpperCase(Locale.ROOT)); //=C51A
        // 小写转换大写
        System.out.println(str.toLowerCase());// =c51a
        // 分割字符串
        String[] as = str.split("1");
        System.out.println(Arrays.toString(as)); // [=C5, a]

        // System.out.println(3 ^ 5 ^ 6);


    }
}
